import request from "@/utils/request"
export const addArticle = async(params) => {
    let data = {
        ...params,
        views: 0,
        is_hot: false,
        create_at: new Date(),
        likeCount: 0,
    }
    return request.post("/articles", data)
}


export const getList = async() => {
    return request({
        url: '/articles',
    })
}

export const getListById = async(id) => {
    return request({
        url: '/articles/' + id
    })
}
export const chengeListById = async(params) => {
    return request({
        url: '/articles/' + params.id,
        method: 'PATCH',
        data: params
    })
}


export const delArticle = async(id) => {
    return request({
        url: '/articles/' + id,
        method: 'DELETE'
    })
}